package model

import "gorm.io/gorm"

type MsgType uint8

const (
	LeaveMessage MsgType = iota
	Complaint
	Inquiry
	PostSale
	WantToBuy
)

// LeavingMessages 留言
type LeavingMessages struct {
	gorm.Model
	UserID      int32   `gorm:"type:int unsigned;index;comment:用户ID"`
	MessageType MsgType `gorm:"type:tinyint unsigned;comment:留言类型:0(留言),1(投诉),2(询问),3(售后),4(求购)"`
	Subject     string  `gorm:"type:varchar(100);comment:主题"`
	File        string  `gorm:"type:varchar(200);comment:文件URL"`
	Message     string  `gorm:"comment:正文内容"`
}

// Address 收货地址
type Address struct {
	gorm.Model
	UserID       int32  `gorm:"type:int unsigned;index;comment:用户ID"`
	Province     string `gorm:"type:varchar(10);comment:省"`
	City         string `gorm:"type:varchar(10);comment:市"`
	District     string `gorm:"type:varchar(20);comment:区"`
	Address      string `gorm:"type:varchar(100);comment:详细地址"`
	SignerName   string `gorm:"type:varchar(20);comment:收货人姓名"`
	SignerMobile string `gorm:"type:varchar(11);comment:收货人电话"`
}

// UserFav 商品收藏
type UserFav struct {
	gorm.Model
	UserID  int32 `gorm:"type:int unsigned;index:idx_user_goods,unique"`
	GoodsID int32 `gorm:"type:int unsigned;index:idx_user_goods,unique"`
}
